package com.yzzrjy.controller.mainservlet.user;

import com.yzzrjy.Service.UserService;
import com.yzzrjy.bean.UserLetBean;
import com.yzzrjy.util.ResponseUtils;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

@WebServlet(name = "GetUserLetListServlet", value = "/getUserLetList")
public class GetUserLetListServlet extends HttpServlet {
    private UserService userService = new UserService();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String uidS = request.getParameter("uids");
        if(uidS == null){
            ResponseUtils.parameterError(response);
            return;
        }
        try{
            List<UserLetBean> list = userService.getUserLetList(uidS);
            ResponseUtils.success(response, list);
        }catch (SQLException e){
            throw new RuntimeException(e);
        }

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
